<template>
  <div class="login-container"></div>
</template>

<script>
import { validUsername } from "@/utils/validate";
import { setToken } from "@/utils/auth";
import config from '@/config'

export default {
  name: "Login",
  data() {
    return {
      redirect: undefined
    };
  },
  watch: {
    $route: {
      handler: function(route) {
        this.redirect = route.query && route.query.redirect;
      },
      immediate: true
    }
  },
  beforeCreate() {
    if (this.$route.query.process) {
      // config.menus[response.data.role.extend]
      localStorage.setItem("router", this.$route.query.process);
    }
    if (this.$route.query.menus) {
      // config.menus[response.data.role.extend]
      localStorage.setItem("menusName", this.$route.query.menus);
    }
    if (this.$route.query.user) {
      localStorage.setItem("user", this.$route.query.user);
    }
    if (this.$route.query.projectId) {
      localStorage.setItem("projectId", this.$route.query.projectId);
      
    }
    if (this.$route.query.name) {
      localStorage.setItem("projectName", this.$route.query.name);
    }
    if (this.$route.query.userId) {
      localStorage.setItem("userId", this.$route.query.userId);
    }
    if (this.$route.query.token) {
      setToken(this.$route.query.token);
    }
  },
  created() {
    
    this.$router.push("/");
  },
  mounted() {
  },
  methods: {}
};
</script>

<style lang="scss">
/* 修复input 背景不协调 和光标变色 */
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */

$bg: #283443;
$light_gray: #999;
$cursor: #999;

@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
  .login-container .el-input input {
    color: $cursor;
  }
}

/* reset element-ui css */
.login-container {
  .el-input {
    display: inline-block;
    height: 47px;
    width: 85%;

    input {
      background: transparent;
      border: 0px;
      -webkit-appearance: none;
      border-radius: 0px;
      padding: 12px 5px 12px 15px;
      color: $light_gray;
      height: 47px;
      caret-color: $cursor;

      &:-webkit-autofill {
        box-shadow: 0 0 0px 1000px $bg inset !important;
        -webkit-text-fill-color: $cursor !important;
      }
    }
  }

  .el-form-item {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #fff;
    border-radius: 5px;
    color: #454545;
  }
}
</style>

<style lang="scss" scoped>
$bg: #08182f;
$dark_gray: #889aa4;
$light_gray: #eee;

.login-container {
  min-height: 100%;
  width: 100%;
  background-color: $bg;
  overflow: hidden;

  .login-bg {
    position: absolute;
    width: 100%;
    height: 100%;
  }

  .logo-box {
    background: url(../../assets/login/logo.png) no-repeat;
    width: 120px;
    height: 120px;
    display: block;
    margin: 150px auto 0;
  }
  .title-box {
    font-size: 40px;
    color: #fff;
    text-align: center;
    margin-top: 50px;
  }
  .foot-box {
    width: 100%;
    text-align: center;
    font-size: 12px;
    color: #ccc;
    position: fixed;
    left: 0;
    bottom: 50px;
  }
  .login-form {
    position: relative;
    width: 520px;
    max-width: 100%;
    padding: 60px 35px 0;
    margin: 0 auto;
    overflow: hidden;
  }

  .tips {
    font-size: 14px;
    color: #fff;
    margin-bottom: 10px;

    span {
      &:first-of-type {
        margin-right: 16px;
      }
    }
  }

  .svg-container {
    padding: 6px 5px 6px 15px;
    color: $dark_gray;
    vertical-align: middle;
    width: 30px;
    display: inline-block;
  }

  .title-container {
    position: relative;

    .title {
      font-size: 16px;
      color: $light_gray;
      margin: 0px auto 40px auto;
      text-align: center;
      font-weight: bold;
      text-indent: 10px;
    }
  }

  .show-pwd {
    position: absolute;
    right: 10px;
    top: 7px;
    font-size: 16px;
    color: $dark_gray;
    cursor: pointer;
    user-select: none;
  }
}
</style>
